<template>
    <div>
        a页面:
        <!-- {{ a }} -->
        <button @click="handle">点击</button>
        {{ isLogin }}

    </div>
</template>
<script>
import {mapstate,mapMutations,mapActions} from "vuex"

export default {
    data () {
        return {
            // a: 1
        }
    },
    // created () {
    //     this.a = this.$store.state.isLogin
    //     console.log(this.a);
    // },
    computed: {
        ...mapstate("user",{
        isLogin:(state)=>state.isLogin    
        })

        // isLogin () {
        //     // 
        //     return this.$store.state.user.isLogin
        // }
    },
    methods: {
        ...mapMutations("user",["change"]),

        async handle () {
            this.change(true)
            // this.$store.commit("user/change",true)//true,参数可以传对象
            // let token = await this.$store.dispatch("user/change", true);//true,参数可以传对象
            // console.log(token);
        }
    }
}
</script>

<style lang="scss" scoped>
</style>